<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class RoomType extends Model
{
    public function rooms(){
        return $this->hasMany(Room::class);
    }

    public function price(){
        return $this->hasOne(Price::class);
    }

    public function availabilities(){
        return $this->hasMany(Availability::class);
    }

    //TODO: 通过 RoomType 寻找预定和入住记录, 这里也许不对
    public function bookings(){
        return $this->hasManyThrough(Booking::class, Availability::class);
    }

    public function orders(){
        return $this->hasManyThrough(Order::class, Availability::class);
    }
}
